package com.fashionista;

import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

/**
 * A class representing the events page of the application
 * 
 * @author Trevor Adelman, Patrick Koperwas, Tong Wu, Shayan Yassami
 * @version for cs48 group project, 3/11/2011
 */
public class EventsActivity extends Activity {
	TextView EventTitle, TextEventName, TextEventTime, TextEventDate;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.events);

		// text boxes for "Event Page","Event Name", and "Time"
		EventTitle = (TextView) findViewById(R.id.EventTitle);
		TextEventName = (TextView) findViewById(R.id.TextEventName);
		TextEventTime = (TextView) findViewById(R.id.TextEventTime);
		TextEventDate = (TextView) findViewById(R.id.TextEventDate);

		// Edit Text for the Event Name
		final EditText edittext = (EditText) findViewById(R.id.EditEventText);
		edittext.setOnKeyListener(new OnKeyListener() {
			public boolean onKey(View events, int keyCode, KeyEvent event) {
				// If the event is a key-down event on the "enter" button
				if ((event.getAction() == KeyEvent.ACTION_DOWN)
						&& (keyCode == KeyEvent.KEYCODE_ENTER)) {
					// Perform action on key press
					Toast.makeText(EventsActivity.this, edittext.getText(),
							Toast.LENGTH_LONG).show();
					
					return true;
				}
				return false;
			}
		});

		// edit text for event time
		final EditText edittime = (EditText) findViewById(R.id.editEventTime);
		edittime.setOnKeyListener(new OnKeyListener() {
			public boolean onKey(View events, int keyCode, KeyEvent event) {
				// If the event is a key-down event on the "enter" button
				if ((event.getAction() == KeyEvent.ACTION_DOWN)
						&& (keyCode == KeyEvent.KEYCODE_ENTER)) {
					// Perform action on key press
					Toast.makeText(EventsActivity.this, edittime.getText(),
							Toast.LENGTH_SHORT).show();
					return true;
				}
				return false;
			}
		});

		final EditText editdate = (EditText) findViewById(R.id.editEventDate);
		editdate.setOnKeyListener(new OnKeyListener() {
			public boolean onKey(View events, int keyCode, KeyEvent event) {
				// If the event is a key-down event on the "enter" button
				if ((event.getAction() == KeyEvent.ACTION_DOWN)
						&& (keyCode == KeyEvent.KEYCODE_ENTER)) {
					// Perform action on key press
					Toast.makeText(EventsActivity.this, editdate.getText(),
							Toast.LENGTH_SHORT).show();

					return true;
				}
				return false;
			}
		});

	}
}